package com.party.core.model.log;

import com.google.common.collect.Maps;

import java.util.HashMap;

/**
 * Created by wei.li
 *
 * @date 2017/8/23 0023
 * @time 15:05
 */
public enum BehaviorType {

    EXPORT("EXPORT", "导出"),

    REFUND("REFUND", "退款"),

    INSERT("INSERT", "新增"),

    UPDATE("UPDATE", "更新"),

    DELETE("DELETE", "删除"),

    LOGIN("LOGIN", "登陆"),

    SCAN_LOGIN("SCAN_LOGIN", "扫码登陆"),

    UNBIND("UNBIND", "解绑"),

    CROWDFUND_DETAIL("CROWDFUND_DETAIL", "众筹详情"),

    CROWDFUND_ACTIVITY_DETAIL("CROWDFUND_ACTIVITY_DETAIL", "众筹项目详情"),

    CROWDFUND_SUPPORT("CROWDFUND_SUPPORT", "众筹支持"),

    CROWDFUND_APPLY("CROWDFUND_APPLY", "发起众筹"),

    REPRESENT_DETAIL("REPRESENT_DETAIL", "联合发起详情"),

    ARTICLE_DETAIL("ARTICLE_DETAIL", "文章详情"),

    ACTIITY_DETAIL("ACTIITY_DETAIL", "活动详情"),

    ACTIVITY_APPLY("ACTIVITY_APPLY", "活动报名"),

    CUSTOMIZE_GOODS_DETAIL("CUSTOMIZE_GOODS_DETAIL", "定制玩法详情"),

    GOODS_DETAIL("GOODS_DETAIL", "标准玩法"),

    MEMBER_INSERT("MEMBER_INSERT","新增会员"),
    MEMBER_UPDATE("MEMBER_UPDATE","修改会员"),
    MEMBER_RECOMMEND_UPDATE("MEMBER_RECOMMEND_UPDATE","修改推荐积分"),
    MEMBER_RECOMMEND_INSERT("MEMBER_RECOMMEND_INSERT","添加推荐关系"),
    MEMBER_ASSIGN_BRANCH("MEMBER_ASSIGN_BRANCH","分配分社"),
    MEMBER_CHECK("MEMBER_CHECK","会员审核"),
    MEMBER_LISTEXPORT("MEMBER_LISTEXPORT","会员数据导出"),
    MEMBER_CUSTOM_FROM_UPDATE("MEMBER_CUSTOM_FROM_UPDATE","修改表单值");

    //状态码
    private String code;

    //状态值
    private String value;

    BehaviorType(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(String code){
        for (BehaviorType behaviorType : BehaviorType.values()){
            if (behaviorType.getCode().equals(code)){
                return behaviorType.getValue();
            }
        }
        return null;
    }

    public static HashMap<String, String> convertMap(){
        HashMap<String, String> map = Maps.newHashMap();
        for (BehaviorType behaviorType : BehaviorType.values()){
            map.put(behaviorType.getCode(), behaviorType.getValue());
        }
        return map;
    }
}
